from restful.api__.admin.info.SystemAllPostsUnchecked import SystemAllPostsUnchecked
from restful.api__.admin.info.SystemAllUsersNotAdmin import SystemAllUsersNotAdmin
from restful.api__.admin.service.Check import Check
from restful.api__.private.service.CommentOrCancel import CommentOrCancel
from restful.api__.private.service.FollowOrCancel import FollowOrCancel
from restful.api__.private.service.LikeOrCancel import LikeOrCancel
from restful.api__.private.service.PostOrUpdateOrDelete import PostOrUpdateOrDelete
from restful.api__.public__.info.atomic.PersonalInfo import PersonalInfo
from restful.api__.public__.info.atomic.PostAllComments import PostAllComments
from restful.api__.public__.info.atomic.PostAllLikes import PostAllLikes
from restful.api__.public__.info.atomic.PostInfoPublished import PostInfoPublished

from restful.api__.public__.info.atomic.RoleInfo import RoleInfo
from restful.api__.public__.info.atomic.UserAllComments import UserAllComments
from restful.api__.public__.info.atomic.UserAllCommentsInOnePost import UserAllCommentsInOnePost
from restful.api__.public__.info.atomic.UserAllFans import UserAllFans
from restful.api__.public__.info.atomic.UserAllFollowing import UserAllFollowing
from restful.api__.public__.info.atomic.UserAllLikes import UserAllLikes
from restful.api__.public__.info.atomic.UserAllPostsPublished import UserAllPostsPublished
from restful.api__.public__.info.atomic.UserAllPostsPublishedGetLikes import UserAllPostsPublishedGetLikes
from restful.api__.public__.info.atomic.UserName import UserName
from restful.api__.public__.info.atomic.system.SystemAllFunctions import SystemAllFunctions
from restful.api__.public__.info.atomic.system.SystemAllNavUrls import SystemAllNavUrls
from restful.api__.public__.info.composite.post.PostInfoPublishedDetail import PostInfoPublishedDetail
from restful.api__.public__.info.composite.post.list.PostsListBySimilar import PostsListBySimilar
from restful.api__.public__.info.composite.post.list.hot.PostsListByHot import PostsListByHot
from restful.api__.public__.info.composite.post.list.PostsListByMyFollowing import PostsListByMyFollowing
from restful.api__.public__.info.composite.post.list.recent.PostsListByRecent import PostsListByRecent
from restful.api__.public__.info.composite.post.list.PostsListBySort import PostsListBySort

from restful.api__.public__.info.composite.post.list.hot.PostsRank10TopHot import PostsRank10TopHot
from restful.api__.public__.info.composite.post.list.recent.PostsRank10TopRecent import PostsRank10TopRecent

from restful.api__.public__.service.LoginOrRegister import Register, Login


def restful_register(api):
    # Account related endpoints
    api.add_resource(Register, '/api__/register')
    api.add_resource(Login, '/api__/login')

    # User related endpoints
    api.add_resource(UserName, '/api__/user/<int:uid>/username')
    api.add_resource(UserAllPostsPublished, '/api__/user/<int:uid>/posts/published')
    api.add_resource(UserAllLikes, '/api__/user/<int:uid>/likes')
    api.add_resource(UserAllFollowing, '/api__/user/<int:uid>/following')
    api.add_resource(UserAllFans, '/api__/user/<int:uid>/fans')
    api.add_resource(UserAllComments, '/api__/user/<int:uid>/comments')
    api.add_resource(UserAllCommentsInOnePost, '/api__/user/<int:uid>/post/<int:pid>/comments')
    api.add_resource(RoleInfo, '/api__/user/<int:uid>/role')
    api.add_resource(PersonalInfo, '/api__/user/<int:uid>/personal')
    api.add_resource(UserAllPostsPublishedGetLikes,'/api__/user/<int:uid>/posts/published/get/likes')

    api.add_resource(PostOrUpdateOrDelete, '/api__/post')
    api.add_resource(PostInfoPublished, '/api__/post/<int:pid>/published')
    api.add_resource(PostAllLikes, '/api__/post/<int:pid>/likes')
    api.add_resource(PostAllComments, '/api__/post/<int:pid>/comments')

    # Interaction endpoints
    api.add_resource(LikeOrCancel, '/api__/post/<int:pid>/like')
    api.add_resource(FollowOrCancel, '/api__/user/<int:uid>/follow')
    api.add_resource(CommentOrCancel, '/api__/post/<int:pid>/comment', '/api__/comment/<int:cid>')

    # Admin/system endpoints
    api.add_resource(Check, '/api__/post/<int:pid>/check')
    api.add_resource(SystemAllUsersNotAdmin, '/api__/system/users/non-admin')
    api.add_resource(SystemAllPostsUnchecked, '/api__/system/posts/unchecked')
    api.add_resource(SystemAllFunctions,'/api__/system/functions')
    api.add_resource(SystemAllNavUrls,'/api__/system/nav/urls')

    api.add_resource(PostsRank10TopHot,'/api__/posts/rank/10top/hot')
    api.add_resource(PostsRank10TopRecent,'/api__/posts/rank/10top/recent')
    api.add_resource(PostsListByHot,'/api__/posts/list/by/hot')
    api.add_resource(PostsListByRecent,'/api__/posts/list/by/recent')

    api.add_resource(PostsListByMyFollowing,'/api__/posts/list/by/following')
    api.add_resource(PostsListBySimilar,'/api__/posts/list/by/similar')

    api.add_resource(PostsListBySort,'/api__/posts/list/by/sort')
    api.add_resource(PostInfoPublishedDetail,'/api__/post/info/published/detail/<int:pid>')